import { Controller, Get, HttpException, HttpStatus, Module, Post, Req, UseFilters } from '@nestjs/common';
import { CatsService } from './cats.service';
import { User, UserEntity } from 'src/cats/user.decorator';
import { ConfigModule, ConfigService } from '@nestjs/config';
// import { Cat } from './interfaces/cat.interface';
// import { HttpExceptionFilter } from '../http-exception.filter';

@Controller('/api/cats')
@Module({
  imports: [ConfigModule]
})
export class CatsController {
  constructor(
    private catsService: CatsService,
    private configService: ConfigService
  ) {}

  @Post()
  async create(@Req() request: Request) {
    this.catsService.create(request.headers);
  }

  @Get()
  // @UseFilters(new HttpExceptionFilter())
  async findAll(@User('web') user: Record<string, any>) {
    return user;
    // this.catsService.create(user);
    // return this.catsService.findAll();
  }
}
